package test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import cesdentalrecord.dao.Student;
import cesdentalrecord.dao.StudentPeer;


public class SearchStudent {

	public Student search() throws IOException{
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		
		String surname;
		String firstname;
		String mi;
		
		System.out.println("input Surname: ");
		surname=input.readLine();
		
		System.out.println("input Firstname: ");
		firstname=input.readLine();
		
		System.out.println("input Middle Initial: ");
		mi=input.readLine();
		
		Student s = StudentPeer.searchUser(surname, firstname, mi);
		
		if(s == null){
			System.out.println("student not found");
			return s;
		}else{
			System.out.println("student found");
			System.out.println(s.getSurname() + ", " +  s.getFirstname() + " " + s.getMi());
			return s;
		}
		
	}
}
